//
//  DayTime.swift
//  MyKebiao
//
//  Created by David on 2016/12/2.
//  Copyright © 2016年 David. All rights reserved.
//

import Foundation

func _get_weekday(num: Int, starter: Int) -> String? {
    let cod = (num+starter)%7
    switch cod {
    case 0:
        return "周日"
    case 1:
        return "周一"
    case 2:
        return "周二"
    case 3:
        return "周三"
    case 4:
        return "周四"
    case 5:
        return "周五"
    case 6:
        return "周六"
    default:
        return nil
    }
}

func _get_weekday(name: String, starter: Int) -> Int? {
    var cod = 0
    switch name {
    case "周日":
        cod = 0
    case "周一":
        cod = 1
    case "周二":
        cod = 2
    case "周三":
        cod = 3
    case "周四":
        cod = 4
    case "周五":
        cod = 5
    case "周六":
        cod = 6
    default:
        return nil
    }
    return (cod+7 - starter)%7
}
